package com.lisy.demo.activity;

import android.app.Activity;
import android.os.Bundle;
import android.os.SystemClock;
import android.view.View;
import android.widget.TextView;

import com.lisy.demo.model.Add;
import com.lisy.library.R;
import com.lisy.library.io.StorageFactory;


public class IOActivity extends Activity {
    private Add add = null;
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        add = StorageFactory.INSTANCE.getKeyValueStorage(Add.class,
                IOActivity.this);
        setContentView(R.layout.activity_io);
        findViewById(R.id.btn_add).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(add == null){
                    return;
                }
                add.setLatitude(String.valueOf(SystemClock.currentThreadTimeMillis()));
                add.setLongitude("113.00");
            }
        });
        if(add == null){
            return;
        }
        String x = add.getLongitude();
        String y = add.getLatitude();

        TextView tv = (TextView) findViewById(R.id.content);
        tv.setText(x+","+y);
    }
}
